//
//  EmptyPlaceholderRelationTableViewCell.swift
//  Swift-Codedase
//
//  Created by xyanl on 2023/12/19.
//

import UIKit

class EmptyPlaceholderRelationTableViewCell: YLEmptyDataTableViewCell {
    
    @IBOutlet weak var placeholderImageView: UIImageView!
    
    @IBOutlet weak var titleLabel: UILabel!
    
    @IBOutlet weak var subTitleLabel: UILabel!
    
    @IBOutlet weak var clickButton: UIButton!
    
    @IBOutlet weak var centerLayoutY: NSLayoutConstraint!
    
    override var data: YLEmptyDataModel? {
        didSet {
            // #imageLiteral(resourceName: "summer-ball")
            contentView.backgroundColor = .clear
            backgroundColor = .clear
            
            placeholderImageView.image = data?.image
            titleLabel.text = data?.title
            subTitleLabel.text = data?.subtitle
            centerLayoutY.constant = self.contentView.frame.size.height * (data?.verticalMargin)!
            
            clickButton.isHidden = true
            if (data?.action) != nil {
                clickButton.setTitle(data?.action, for: .normal)
                clickButton.isHidden = false
            }
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        clickButton.addRoundedCorners(radius: 22)
    }
    
    @IBAction func clickAction(_ sender: UIButton) {
        onActionButtonTap?()
    }
    
}
